#include "StdAfx.h"
#include "BulletinBoardSystem.h"
#include "predefinedModuleID.h"

namespace _FOGGE_
{
	namespace _GDB_ 
	{
		BulletinBoardSystem::BulletinBoardSystem(void)
		{
			m_BoardVector.resize(eEMID_ModuleCount);

			for(int i=0;i<eEMID_ModuleCount;i++)
				m_BoardVector[i]=NULL;
		}

		BulletinBoardSystem::~BulletinBoardSystem(void)
		{
		}


		void BulletinBoardSystem::RegisterBoard(int moduleID,BulletinBoard* ptrBoard)
		{
			assert(moduleID>=0&&moduleID<eEMID_ModuleCount&&_T("moduleID has invalid value"));
			m_BoardVector[moduleID]=ptrBoard;

		}
		void BulletinBoardSystem::PostModification(int moduleID,foDataObject* ptrDO)
		{
			assert(moduleID>=0&&moduleID<eEMID_ModuleCount&&_T("moduleID has invalid value"));
			if(m_BoardVector[moduleID]==NULL)
			{
				logSourceStamp_Broadcast(_UTIL_::Logger::eLL_Develop);
				logFormat_Broadcast(_UTIL_::Logger::eLL_Develop,_T("engine module(id:%d) is not registered at BulletinBoardSystem."));
				return;
			}
			m_BoardVector[moduleID]->Post(ptrDO);
		}

	}
}